//ES6对象写法
class student{//function的语法糖
    //构造函数
    constructor(name){
        this.name = name
    }
    study(){
        console.log(this.name+'在学习');
    }
    sleep(){
        console.log(this.name+'在睡觉')
    }
}

let stu1 = new student('tom');
// stu1.sleep();
// console.log(stu1.sleep)
let funcName = 'study';

stu1[funcName]()



